<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/9/11
  Time: 18:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>家庭财务管理系统</title>
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/JavaScript" src="js/common.js"></script>
    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
    <script>
        $().ready(function () {
            $("#autologin").click(function () {
                var uname = $(":text[name=uname]").prop("value");
                var pwd = $(":password[name=pwd]").prop("value");
                var vcode = $(":text[name=vcode]").prop("value");
                //alert(pwd);
                if (uname==""){
                    alert("未输入账号!")
                }else if(pwd==null || pwd.length <=0){
                   alert("未输入密码!")
                }else if (vcode=="") {
                    alert("未输入验证码!")
                }else {
                    $.ajax({
                        type: "POST",
                        url:"${pageContext.request.contextPath}/loginServlet",
                        data:"uname="+$(":text[name=uname]").prop("value")+"&pwd="+$(":password[name=pwd]").prop("value")+"&code="+$(":text[name=vcode]").prop("value"),
                            success:function (response) {
                            //alert(response)
                            if(response=="2"){
                                alert("账号或者密码不正确!")
                            } else if(response=="1"){
                                $("form[name=myform]").submit();
                            } else if (response=="3"){
                                alert("验证码输入错误!")
                            }
                        }
                    });
                }
            });
            $(":button[name=change]").click(function () {
                $.ajax({
                    type:"POST",
                    url:"${pageContext.request.contextPath}/codeServlet",


                })
            });
        });



    </script>
    <style type="text/css">
        <!--
        body {
            background-color: #c4c3c3;
        }
        -->
    </style></head>

<body onLoad="MM_preloadImages('images/login_10.gif','images/login_09.gif')">

<table width="502" border="0"  align="center" cellpadding="0" cellspacing="0" class="mar001">
    <tr>
        <td background="images/login_02.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="2%" align="left"><img src="images/login_03.gif" width="12" height="30"></td>
                <td width="49%" align="left" class="text001">用户登录</td>
                <td width="49%" align="right"><img src="images/login_01.gif" width="11" height="30"></td>
            </tr>
        </table></td>
    </tr>
    <tr>
        <td height="247" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr valign="top">
                <td width="35%" height="232"><img src="images/login_05.gif" width="178" height="269"></td>
                <td width="65%" align="right" background="images/login_06.gif" class="bg01"><img src="images/login_04.gif" width="268" height="47" class="mar002">
                    <form action="accountListServlet" method="post" name="myform">
                    <table width="90%" height="125"  border="0" cellpadding="0" cellspacing="0" class="mar003">
                        <tr>
                            <td width="32%" height="38" align="right" class="text002">用户名</td>
                            <td width="68%" align="left" valign="middle"><input name="uname" type="text" class="inp001" ></td>
                        </tr>
                        <tr>
                            <td height="37" align="right" class="text002">密码</td>
                            <td align="left" valign="middle"><input name="pwd" type="password" class="inp001"></td>
                        </tr>

                        <tr>
                            <td height="37" align="right" class="text002">验证码</td>
                            <td align="left" valign="middle">&nbsp;&nbsp;&nbsp;<input name="vcode" type="text" size="6">&nbsp;&nbsp;&nbsp;<img name="code" src="codeServlet"><input type="button" value="看不清楚换一张" name="change"> </td>
                        </tr>
                        <tr>
                            <td height="50">&nbsp;</td>
                            <td align="left" valign="bottom">
                                <a onMouseOver="MM_swapImage('Image1','','images/login_10.gif',1)" onMouseOut="MM_swapImgRestore()" onMouseDown="MM_swapImage('Image1','','images/login_12.gif',1)" onMouseUp="MM_swapImage('Image1','','images/login_10.gif',1)" name="autologin" id="autologin" onclick="check()">
                                <img src="images/login_08.gif" name="Image1" width="75" height="24" border="0" id="Image1"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                <a href="javascript:window.close();" onMouseOver="MM_swapImage('Image2','','images/login_09.gif',1)" onMouseOut="MM_swapImgRestore()" onMouseDown="MM_swapImage('Image2','','images/login_11.gif',1)" onMouseUp="MM_swapImage('Image2','','images/login_09.gif',1)">
                                    <img src="images/login_07.gif" name="Image2" width="75" height="24" border="0" id="Image2"></a></td>
                        </tr>
                    </table>
                    </form>
                </td>

            </tr>
        </table></td>
    </tr>
</table>
</body>
</html>

